//
//  KSPickerOrderTableViewCell.swift
//  Supermarket
//
//  Created by Black_Crystal on 2017/9/25.
//  Copyright © 2017年 kushao. All rights reserved.
//

import UIKit

class KSPickerOrderTableViewCell: UITableViewCell {

    private var titleLabel = UILabel()
    private var selectImg = UIImageView()
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.selectionStyle = .none
        
        titleLabel.font = UIFont.systemFont(ofSize: 14)
        self.contentView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalTo(40)
        }
        
        selectImg.isHidden = true
        selectImg.image = UIImage.init(named: "selected")
        self.contentView.addSubview(selectImg)
        selectImg.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.right.equalTo(-10)
            make.width.height.equalTo(15)
        }
    }
    
    func setTitleAndImg(title: String,isSelect: Bool) {
        titleLabel.text = title
        selectImg.isHidden = !isSelect
        if isSelect {
            titleLabel.textColor = KSColor.kColorMainRed
        } else {
            titleLabel.textColor = KSColor.kColor_9
        }
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
